<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .parent{
            width: 200px;
            height: 200px;
            position: relative;
        }
        .parent div{
            width: 200px;
            height: 200px;
            position: absolute;
        }
        .html{
            background-color: red;
            z-index: 100;
        }
        .css{
            background-color: yellow;
        }
        .current{color: orangered;}
    </style>
</head>
<body>
    <ul>
        <li class="current">html</li>
        <li>css</li>
    </ul>
    <div class="parent">
        <div class="html"></div>
        <div class="css"></div>
    </div>
    <script>
        var lis =document.getElementsByTagName("li");
        var divs = document.querySelectorAll(".parent div");

        for(let i = 0;i<lis.length;i++){
            lis[i].index=i;
            lis[i].onclick = function(){
                for (let i =0;i<lis.length;i++){
                    lis[i].classList.remove("current");
                }this.classList.add("current");

                for(let i =0;i<divs.length;i++){
                    divs[i].style.display = "none";
                }
                divs[i].style.display = "block";
            }
        }
    </script>
</body>
</html>